<?php
class ItemLogsVo extends SzAbstractMySqlVo
{

    private $userId;
    private $itemDefId;
    private $count;

    /**
     * Initialize ItemLogsVo.
     *
     * @param $userId
     * @param $itemDefId
     * @param $count
     * @param boolean $isInsert default false, means for now this vo is initialized not for insert process
     * @return ItemLogsVo
     */
    public function __construct($userId, $itemDefId, $count, $isInsert = false) {
        $this->userId = $userId;
        $this->itemDefId = $itemDefId;
        $this->count = $count;

        $this->isInsert = $isInsert;
        $this->voClassName = 'ItemLogsVo';
        $this->ormName = 'ItemLogs';
    }

    /**
     * @see SzAbstractVo::toArray
     */
    public function toArray($needEncode = false)
    {
        return array(
            'userId' => $this->getUserId(),
            'itemDefId' => $this->getItemDefId(),
            'count' => $this->getCount(),
        );
    }

    /**
     * @see SzAbstractVo::toEntireArray
     */
    public function toEntireArray($needEncode = false)
    {
        return array(
            'userId' => $this->getUserId(),
            'itemDefId' => $this->getItemDefId(),
            'count' => $this->getCount(),
        );
    }

    /**
     * @see SzAbstractVo::toPureArray
     */
    public function toPureArray()
    {
        return array(
            $this->getUserId(),
            $this->getItemDefId(),
            $this->getCount(),
        );
    }

    public function getUserId()
    {
        return $this->userId;
    }

    public function setUserId($val)
    {
        $this->saveColumnStatus(0, $this->userId);
        $this->userId = $val;
    }

    public function getItemDefId()
    {
        return $this->itemDefId;
    }

    public function setItemDefId($val)
    {
        $this->saveColumnStatus(1, $this->itemDefId);
        $this->itemDefId = $val;
    }

    public function getCount()
    {
        return $this->count;
    }

    public function setCount($val)
    {
        $this->saveColumnStatus(2, $this->count);
        $this->count = $val;
    }

    public function updateCount($val)
    {
        $this->setCount($this->count + $val);
    }

}